package com.codingfuture.web.controller;

import com.codingfuture.entity.Person;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Author kobe
 * @Date 2021/11/5 09:58
 * @Description
 */
//@Controller
//@ResponseBody
@RestController
@RequestMapping("/json")
public class JsonController {

    @RequestMapping(value = "/send", method = RequestMethod.POST)
    public void send(@RequestBody Person person) {
        System.out.println(person);
    }

    @RequestMapping(value = "/receive")
    public List<Person> send() {
        ArrayList<Person> list = new ArrayList<>();
        list.add(new Person(1, "zs", "123"));
        list.add(new Person(2, "ls", "1234"));
        return list;
    }
//    @RequestMapping(value = "/receive")
//    @ResponseBody
//    public List<Person> send1() {
//        ArrayList<Person> list = new ArrayList<>();
//        list.add(new Person(1, "zs", "123"));
//        list.add(new Person(2, "ls", "1234"));
//        return list;
//    }
}
